Ext.namespace('VAS');
/**
 * 审核步骤弹出窗口中的表单窗口
 * @param {} $config
 */
VAS.AuditSelectForm = function($config) {
	var _this = this;
	this.config = $config;
	VAS.AuditSelectForm.superclass.constructor.call(this,$config);
};
Ext.extend(VAS.AuditSelectForm,Ext.form.FormPanel,{
	id:"AuditSelectForm",
	initComponent : function() {
		var _this = this;
		var accout = new Ext.form.TextField({
			fieldLabel:"用户名称",
			labelAlign:"right",
			id:"userName"
        });
		var realName = new Ext.form.TextField({
			fieldLabel:"真实姓名",
			labelAlign:"right",
			id:"realName"
        });
        var search = new Ext.Button({
			id:"search",
		    text: '查询',
		    width : 50
		});
		var clean = new Ext.Button({
			id:"clean",
		    text: '清空',
		    width : 50
		});
		//点击查询按钮触发查询事件
		search.on("click",function(search,event){
			var gridStore =  Ext.getCmp("AuditSelectGrid").store;
			var _params = {
				"start"          : 0,
				"limit"          : 10
			};
			var formValues = _this.getForm().getValues();
			gridStore.baseParams = formValues;
			Ext.apply(gridStore.baseParams,_params);
			gridStore.load({
				params: _params
			});
		});
		//点击清空按钮清空form
		clean.on('click',function(){
			_this.getForm().reset();
		});
		var thisConfig = {
			height : this.height,	
			labelAlign : "right",
			frame : true,
			layout : "column",
			
			columnWidth : 1,
			border : false,
			items : [{
						layout : "column",
						style : 'margin-top: 10',
						columnWidth : .8,
						items : [	
							{	
								columnWidth : .45,
								layout : 'form',
								border : false,
								items : accout						
							},{
								columnWidth : .45,
								layout : 'form',
								border : false,
								items : realName						
							}
						]
					}, {
						layout : "column",
						style : 'margin-top: 10',
						columnWidth : .2,
						items : [{
							columnWidth : .44,
							layout : 'form',
							border : false,
							items : search						
						},
						 {
						 	columnWidth : .44,
							layout : 'form',
							border : false,
							items : clean						
						}]
					}
			]
		};
		Ext.apply(this, thisConfig);
		Ext.apply(this.initialConfig, thisConfig);
		VAS.AuditSelectForm.superclass.initComponent.call(this);
	}
});

VAS.AuditSelectFormWindow = function($config) {
	var _this = this;
		var form = new VAS.AuditSelectForm({});
		var thisConfig = {
			title : _this.title,
			width:$config.width,
			height:$config.height,
			items :	[form]
		};
		var _config = $config || {};
		Ext.apply(this, Ext.apply(thisConfig, _config));
	VAS.AuditSelectFormWindow.superclass.constructor.call(this);
};
Ext.extend(VAS.AuditSelectFormWindow,VAS.BasicWindow,{
	initComponent : function() {
		VAS.AuditSelectFormWindow.superclass.initComponent.call(this);
	}
});

Ext.reg('auditSelect-form',VAS.AuditSelectFormWindow);

